// @ts-ignore
/* eslint-disable */

import { userRequest } from '@/utils/HttpRequest';
import { NodeData } from '@antv/g6';

export async function findByPageList(params?: any) {
  //SwaggerResources

  return userRequest.getList<API.LoginLog>('findByPageList', params);
}

export async function findByPageBackAgentList(params?: any) {
  //SwaggerResources

  return userRequest.getList<API.LoginLog>('findByPageBackAgentList', params);
}
export async function serachMiniByPhone(params?: any) {
  //SwaggerResources

  return new Promise<API.GlobalStatus[]>((resolve, reject) => {
    userRequest
      .get<API.GlobalStatus[]>('serachMiniByPhone', { phone: params?.keyWords })
      .then((res) => {
        //   console.log("category/findBySelectList",res)
        resolve(res);
      })
      .catch((e) => {
        reject(e);
      });
  });
}

export async function findByTreeList(userId: string | undefined) {
  //SwaggerResources

  //OrgItem
  // @ts-ignore
  return userRequest.get<NodeData<OrgItem[]>>('findTreeList', {
    userId: userId,
  });
}

export async function findById(userId: number) {
  //SwaggerResources

  //OrgItem
  return userRequest.get<API.Users>('findById', { userId: userId });
}

//findMyParentList
export async function findMyParentList(userId: any) {
  //SwaggerResources

  //OrgItem
  return userRequest.get<API.Users>('findMyParentList', { userId: userId });
}

export async function editWalletReChange(params: API.Users) {
  return userRequest.post<any>('wallet/backwithdrawal', params);
}

export async function editIntegralReChange(params: API.Users) {
  return userRequest.post<API.BaseResult>('wallet/backIntegral', params);
}

export async function editUsers(params: API.Users) {
  return userRequest.post<API.BaseResult>('edit', params);
}
//passwordEdit
export async function passwordEdit(params: {
  password: string;
  userId: number;
}) {
  return userRequest.post<API.BaseResult>('passwordEdit', params);
}
export async function phoneEdit(params: { phone: string; userId: number }) {
  return userRequest.post<API.BaseResult>('phoneEdit', params);
}
export async function agentEdit(params: { agentId: number; userId: number }) {
  return userRequest.post<API.BaseResult>('agentEdit', params);
}
export async function editUsersReg(params: API.Users) {
  return userRequest<API.BaseResult>('editReg', {
    method: 'POST',
    data: params,
  });
}

export async function editAgentUpdate(params: API.Users) {
  return userRequest<API.BaseResult>('editAgentUpdate', {
    method: 'POST',
    data: params,
  });
}

export async function brackReUpdate(params: {
  type: number;
  state: number;
  id: number;
}) {
  return userRequest<API.BaseResult>('brackUpdate', {
    method: 'POST',
    data: params,
  });
}
